#include <iostream>
using namespace std;
int R, C;
int dash[11][10001];
void solve();
int n = 0;
int mv = 0;
int main() {
    while (cin >> R >> C && R + C != 0) {
        n = 0;
        mv = 0;
        for (int i = 0; i < R; i++) {
            for (int j = 0; j < C; j++) {
                cin >> dash[i][j];
                if (dash[i][j] == 1) n++;
            }
        }
        solve();
    }
}

void dfs(int r, int c, int num) {
    if (r < R) {
        // 不翻转
        dfs(r + 1, c, num);

        // 翻转
        int t = num;
        for (int i = 0; i < C; i++) {
            dash[r][i] = 1 - dash[r][i];
            if (dash[r][i] == 0) t--;
            else t++;
        }
        dfs(r + 1, c, t);
        // 回溯
        for (int i = 0; i < C; i++) {
            dash[r][i] = 1 - dash[r][i];
        }
    } else {
        // 行递归完毕
        if (c == C) {
            mv = max(mv, num);
            return;
        }
        int ones = 0;
        for (int i = 0; i < R; i++) {
            if (dash[i][c] == 1) ones++;
        }
        if (R - ones > ones) {
            num = num - ones + R - ones;
        }
        dfs(r, c + 1, num);
    }
}

void solve() {
    dfs(0, 0, n);
    cout << mv << endl;
}